// Copyright (c) 2021 Presto Labs Pte. Ltd.
// Author: daniel

#pragma once

#include <string>
#include <unordered_map>

namespace coin2::exchange::gopax::api_util {

class GopaxError {
 public:
  static auto GetGopaxErrorMsg(const std::string& error_code) -> const std::string& {
    if (error_msg_.count(error_code) == 0) {
      return error_msg_.at("99999");
    }
    return error_msg_.at(error_code);
  }

 private:
  static std::unordered_map<std::string, std::string> error_msg_;
};

std::unordered_map<std::string, std::string> GopaxError::error_msg_ = {
    {"100", "Invalid Asset"},
    {"101", "Invalid Trading Pair"},
    {"102", "Invalid User"},
    {"104", "Not Enabled Trading Pair"},
    {"105", "Not Activated Trading Pair"},
    {"106", "Not Enabled Asset"},
    {"107", "Invalid Amount"},
    {"108", "Invalid Price"},
    {"201", "Insufficient Balance"},
    {"202", "Invalid Id"},
    {"203", "Invalid Numbers Overflow"},
    {"204", "Not Allowed Bid Order"},
    {"206", "Invalid Option Combination"},
    {"10004", "Not Authorized"},
    {"10006", "User Not Found"},
    {"10033", "Asset Not Allowed"},
    {"10041", "Invalid Exchange"},
    {"10044", "Invalid Asset Id"},
    {"10052", "Order Server Not Available"},
    {"10056", "No Registered Asset"},
    {"10057", "No Registered Trading Pair"},
    {"10058", "No Such Asset Code"},
    {"10059", "No Such Trading Pair"},
    {"10061", "Invalid Trading Pair Id"},
    {"10062", "Invalid Chart Interval"},
    {"10064", "User Locked"},
    {"10069", "No Such Order Id"},
    {"10074", "Send To Order Server Failed"},
    {"10105", "Rate Limit Exceeded"},
    {"10108", "Nonce Too Low"},
    {"10155", "Invalid Api Key"},
    {"10157", "Invalid Price"},
    {"10166", "Invalid Chart Range"},
    {"10195", "Invalid Internal Data"},
    {"10204", "Not Hedge Token User"},
    {"10212", "Too Small Quote Amount"},
    {"10221", "No Such Client Order Id"},
    {"10222", "Client Order Id Being Used"},
    {"10223", "Soon Expired Client Order Id"},
    {"10227", "Invalid Client Order Id Format"},
    {"10229", "Invalid Signature"},
    {"10230", "No Api Key"},
    {"10231", "No Nonce And Timestamp"},
    {"10232", "Nonce Too High"},
    {"10233", "Unusable Api Key"},
    {"10234", "Cannot Check Rate Limit"},
    {"10255", "Too Long Request Body"},
    {"10256", "Unparsable Request Body"},
    {"10263", "Timestamp Too Low"},
    {"10264", "Timestamp Too High"},
    {"10265", "Choose Either Nonce Or Timestamp"},
    {"10296", "Invalid Receive Window"},
    {"10297", "Invalid Timestamp To Check Receive Window"},
    {"10298", "Fail To Meet Server Arrival Deadline"},
    {"10319", "Pagination Required"},
    {"10358", "Invalid Order Type"},
    {"10359", "Invalid Order Side"},
    {"10360", "Invalid Order Status"},
    {"10361", "Invalid Time In Force"},
    {"10362", "Invalid Protection"},
    {"10364", "Ip Address Banned Temporarily"},
    {"10367", "Mandatory Query String Missing"}};

}  // namespace coin2::exchange::gopax::api_util
